<?php
class IG_View_Helper_JQuery_Button extends ZendX_JQuery_View_Helper_UiWidget
{
    public function button($id, $content, $params=array(), $attribs=array())
    {
        if (!array_key_exists('id', $attribs)) {
            $attribs['id'] = $id;
        }

        if (count($params) > 0) {
            $params = ZendX_JQuery::encodeJson($params);
        } else {
            $params = "{}";
        }

        $js = sprintf('%s("#%s").button(%s);',
                ZendX_JQuery_View_Helper_JQuery::getJQueryHandler(),
                $attribs['id'],
                $params
        );
        $this->jquery->addOnLoad($js);
        
        $html = '<button'
                . $this->_htmlAttribs($attribs)
                . '>'
                . $content
                . '</button>';
        return $html;
    }
}